package com.ruoyi.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author {那蓝桉}
 * @Date: 2023/07/31/ 16:58
 * @description
 */
@Configuration
public class RedisConfig {
//    @Value("${spring.redis.host}")
    private String host = "47.115.223.60";
//    @Value("${spring.redis.port}")
    private String port = "6379";
    private String password = "Jqy010303";

    @Bean
    public RedissonClient redissonClient() {
        Config config = new Config();
        config.useSingleServer().setAddress("redis://" + host + ":" + port);
//        config.useSingleServer().setAddress("redis://localhost:6379");
        config.useSingleServer().setPassword(password);
        RedissonClient redissonClient = Redisson.create(config);
        return redissonClient;
    }
}
